#include <stdio.h>
#include <stdlib.h>
#ifndef _UNISTD_H
#include <windows.h>
#define _UNISTD_H
#include <io.h>
#include <process.h>
#endif /* _UNISTD_H */

#include <sys/types.h>
//#include <sys/wait.h>

#include <signal.h>
#include<time.h>
int static TIME_OUT = 3;
int x = 0;
int main(void)
{
    pid_t pid;
    int status = 0;
    if ((pid = fork()) > 0)
    {
        /*--when time over,you get a signal */
        sleep(TIME_OUT);
        kill(pid, SIGINT);
        waitpid(pid, &status, 0);
    }
    else if (pid == 0) {
        signal(SIGINT, SIG_DFL);
        scanf("%d", &x);
    }
    if (x)
        printf("got a value for x=%d\n", x);
    else
        printf("Got defalut value\n");
    puts("---It's over--");
    return 0;
}
